Intra coding in moving picture coding takes advantage of spatial information inside a picture to reduce spatial redundancy of codes. In order to reduce spatial redundancy, the difference between an image signal of a coding target block and a predictive image derivable from a neighboring block is derived, and the difference value (residual value) is transformed, quantized, and coded.
FIG. 11 is a diagram for describing intra coding according to the conventional H.264/MPEG4 AVC scheme. In FIG. 11, (a) at the top of the figure shows the positional relationship between a coding target block in intra coding and intra predictors to be described later.
A boundary line 1100 in FIG. 11 is a picture boundary or slice boundary. A block 1103 in FIG. 11 is a block that is currently the target for coding by a coding apparatus.
Coding and decoding are performed sequentially, on a block-by-block basis, from the top left towards the bottom right. Therefore, at the time of coding the block 1103, the four blocks consisting of a top left block B0, a top block B1, a top right block B2, and a right block B3, which are surrounding blocks, are already coded or decoded.
Now, a predictive image P is derived from predictors called intra predictors 1102 derived from pixel values of pixels included in all or part of the decoded blocks B0, B1, B2, and B3. The pixels covered by hatching indicate intra predictors that are candidates for use.
In FIG. 11, (b) at the bottom of the figure shows directions for determining the intra predictors to be used in generating a predictive image of the coding target block 1103. The orientation of each arrow in FIG. 11 indicates that, when the coding target block 1103 is located in the direction of the arrow, the intra predictor is located at the base of the arrow.
For example, in the case of an arrow 0, the coding target block 1103 is located at the tip of the arrow 0. Furthermore, the base of the arrow 0 shows the location of the intra predictor to be used for the coding target block 1103.
In the H.264 scheme, it is possible to use modes 0, 1, 3, 4, 5, 6, 7, which respectively correspond to the seven directions indicated by arrows 8, 1, 6, 4, 5, 0, 7, and 3 in FIG. 11, and a mode called DC mode prediction (hereafter also called DC prediction mode).
The coding apparatus determines the intra predictors that are to be actually used, based on the prediction precision of the predictive image derived from the predictors included in the blocks B0, B1, B2, and B3, codes the mode to be applied to the block that is the coding target, and outputs the coded mode. In the case where the 4 pixels included in the block B1 are determined (mode 0) as the intra predictors to be used for such block, the predictive image is generated from these four pixels.
FIG. 12 is a diagram for describing in more detail the location of the intra predictors that are used in the modes corresponding to the seven directions. In the same manner as in FIG. 11, block 1103 is the current coding target block.
For example, when the intra predictors to be used are the four pixels covered in hatching included in block B1, the predictive image P is generated by using the values of the four pixels in the orientation of an arrow 1201 (Direction [0]) indicating a direction.
An arrow 1201 indicates the orientation in the case where the mode 8 is to be used. The value of an intra predictor 1205 included in the already-coded block B3 is copied, and an intra predictor 1205b is set.
FIG. 13 is a diagram for describing an intra predictor in the aforementioned DC mode (mode 2). In this mode, the average value of the pixel values of all the pixels corresponding to the pixels surrounding the coding target block (the pixels covered in hatching in FIG. 13) is the intra predictor of the coding target block 1103. This average value which is one intra predictor is applied uniformly to all pixels making up the predictive image of the coding target block 1103.